/*
 * @Author: wupeiwen <javapeiwen2010@gmail.com>
 * @Date: 2022-03-21 11:34:22
 * @LastEditors: wupeiwen <javapeiwen2010@gmail.com>
 * @LastEditTime: 2023-06-30 11:23:05
 * @FilePath: /tea-garden-web/src/util/router.js
 * @Description: vue-router相关配置
 */
import { createRouter, createWebHashHistory } from 'vue-router'
import systemLogin from '@/pages/system-login.vue'
import statusInfo from '@/pages/status-info.vue'

const routes = [
  {
    path: '/',
    redirect: '/system-login'
  },
  // 登录页面
  {
    path: '/system-login',
    name: 'systemLogin',
    component: systemLogin
  },
  // 状态信息页面
  {
    path: '/status-info/:code',
    name: 'statusInfo',
    component: statusInfo
  },
  // 基地列表
  {
    path: '/base-list',
    name: 'baseList',
    component: () => import(/* webpackChunkName: "base-list" */'@/pages/base-list.vue')
  },
  // 基地概览
  {
    path: '/base-overview',
    name: 'baseOverview',
    redirect: '/base-overview/portal',
    component: () => import(/* webpackChunkName: "base-overview" */'@/pages/base-overview.vue'),
    children: [
      // 首页
      {
        path: 'portal',
        name: 'portal',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "portal" */'@/pages/overview/portal.vue')
        }
      },
      {
        path: 'portal-history',
        name: 'portalHistory',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "farmland-search" */'@/pages/overview/portal-history.vue')
        }
      },
      // 地块-搜索
      {
        path: 'farmland-search',
        name: 'farmlandSearch',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "farmland-search" */'@/pages/overview/farmland-search.vue')
        }
      },
      // 地块-详情
      {
        path: 'farmland-detail',
        name: 'farmlandDetail',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "farmland-detail" */'@/pages/overview/farmland-detail.vue')
        }
      },
      // 专题-病虫害管理
      {
        path: 'subject-disease',
        name: 'subjectDisease',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "subject-disease" */'@/pages/overview/subject-disease.vue')
        }
      },
      // 专题-长势与水肥
      {
        path: 'subject-growth',
        name: 'subjectGrowth',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "subject-growth" */'@/pages/overview/subject-growth.vue')
        }
      },
      // 专题-采摘预测
      {
        path: 'subject-pick',
        name: 'subjectPick',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "subject-pick" */'@/pages/overview/subject-pick.vue')
        }
      },
      // 专题-气象灾害
      {
        path: 'subject-weather',
        name: 'subjectWeather',
        components: {
          'left-drawer': () => import(/* webpackChunkName: "subject-weather" */'@/pages/overview/subject-weather.vue')
        }
      }
    ]
  },
  // 管理-人员
  {
    path: '/manager-person',
    name: 'managerPerson',
    component: () => import(/* webpackChunkName: "manager-person" */'@/pages/manager-person.vue')
  },
  // 分组-人员
  {
    path: '/group-person',
    name: 'groupPerson',
    component: () => import(/* webpackChunkName: "group-person" */'@/pages/group-person.vue')
  },
  // 管理-地块
  {
    path: '/manager-farmland',
    name: 'managerFarmland',
    component: () => import(/* webpackChunkName: "manager-farmland" */'@/pages/manager-farmland.vue')
  },
  // 管理-设备
  {
    path: '/manager-equipment',
    name: 'managerEquipment',
    component: () => import(/* webpackChunkName: "manager-equipment" */'@/pages/manager-equipment.vue')
  },
  // 农事日历
  {
    path: '/farming-calendar',
    name: 'farmingCalendar',
    component: () => import(/* webpackChunkName: "farming-calendar" */'@/pages/farming-calendar.vue')
  },
  // 农事记录
  {
    path: '/farming-records',
    name: 'farmingRecords',
    component: () => import(/* webpackChunkName: "farming-records" */'@/pages/farming-records.vue')
  },
  // 智能农事建议
  {
    path: '/smart-suggestion',
    name: 'smartSuggestion',
    component: () => import(/* webpackChunkName: "smart-suggestion" */'@/pages/smart-suggestion.vue')
  },
  // 未知路由
  {
    path: '/:pathMatch(.*)*',
    redirect: '/status-info/404'
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
